﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using YY.TreeTime;
using Infragistics.Win.UltraWinTree;

namespace Ruler
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();

            this.treeTimer1.BackColor = Color.LightSkyBlue;
            this.treeTimer1.TreeBKColor = Color.LightPink;
            this.treeTimer1.LeftTopRegionBackColor = Color.LightPink;

            this.treeTimer1.ThumbColor = Color.Tomato;
            this.treeTimer1.ThumbColor2 = Color.AliceBlue;

            this.treeTimer1.Ruler.BackColor = Color.White;

            //this.treeTimer1.TreeTimeLineRegionBackColor = Color.Chocolate;
            this.treeTimer1.MouseDownOnThumb += new TreeTimer.MouseOnThumbHandler(treeTimer1_MouseDownOnThumb);

            this.treeTimer1.ItemHeight = 30;

            this.treeTimer1.TotalHours = 5;
        }

        private void treeTimer1_MouseDownOnThumb(RulerSlider sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                MessageBox.Show(sender.Key);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 8; i++)
            {
                this.treeTimer1.AddNode("测试节点" + i.ToString(), "测试节点" + i.ToString(), i * 20);
            }

            UltraTreeNode oNode = this.treeTimer1.GetNode("测试节点2");

            for (int i = 0; i < 6; i++)
            {
                this.treeTimer1.AddSonNode(oNode, "儿子" + i.ToString(), "儿子" + i.ToString(), i * 15);
            }

            oNode = this.treeTimer1.GetNode("儿子2");

            for (int i = 0; i < 4; i++)
            {
                this.treeTimer1.AddSonNode(oNode, "孙子" + i.ToString(), "孙子" + i.ToString(), i * 10);
            }
        }

    }
}
